import {Add,UPDATE,DEL,CHG} from './actionType05'
const initialState = {
    str: "演示redux",
    list: [111, 222, 333]
}
export default (state = initialState, action) => {
    console.log(state, action)
    switch (action.type) {
        case CHG:
            let nstate = { ...state }
            nstate.str = action.data
            return nstate;
        case Add:
            state.list.push(action.data);
            return { ...state, list: [...state.list] };
        case DEL:
            state.list.splice(action.data,1)
            return { ...state, list: [...state.list] };
        default:
            break;
    }
    return state
}

